﻿using Prism.Ioc;
using Prism.Modularity;
using System.Windows;
using WPF01.Views;

namespace WPF01
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<MainWindow>();
        }

        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.RegisterForNavigation<ShowCustomControl>();
            containerRegistry.RegisterForNavigation<_Adorner>();
            containerRegistry.RegisterForNavigation<UCBehavior>();
        }

        /// <summary>
        /// 模块注册
        /// </summary>
        /// <param name="moduleCatalog"></param>
        protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
        {
            base.ConfigureModuleCatalog(moduleCatalog);
            //方式一
            //moduleCatalog.AddModule<AModule>();
        }

        /// <summary>
        /// 模块注册
        /// </summary>
        /// <returns></returns>
        protected override IModuleCatalog CreateModuleCatalog()
        {
            //配置要扫描的目录
            return new DirectoryModuleCatalog()
            {
                ModulePath = "Modules"//建个文件夹装进去
            };
        }
    }
}
